<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:s="http://jboss.com/products/seam/taglib"
      xmlns:a="http://richfaces.org/a4j">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <title>Register New User</title>
  <link href="css/screen.css" rel="stylesheet" type="text/css" />
</head>

<body id="pgHome">
  <div id="document">
    <div id="header">
    </div>
    <div id="container">
      <div id="sidebar">
        <h1>To Create A New User Account</h1>
        <p>Please provide the following:
          <ul>
            <li>Your email address, this will be your username</li>
            <li>Your first and last name</li>
            <li>Your password, this must be betwween 6 and 16 characters in length</li>
          </ul>
        </p>
      </div>

      <div id="content">
        <div class="section">
          <h1>Register</h1>
        </div>
        <div class="section">
          <!-- area to disply global errors -->
          <div class="entry errors">
            <h:messages globalOnly="true"/>
          </div>
          <!-- input form for email, name, password -->
          <h:form id="registration"> 
            <fieldset>

              <!-- s:decorate allows us to replace a section of the document with a another template -->
              <s:decorate id="emailAddressDecorate" template="edit.xhtml">
                <ui:define name="label">Email:</ui:define>
                <h:inputText id="emailAddress" value="#{user.emailAddress}" required="true">
                  <a:support event="onblur" reRender="emailAddressDecorate" />
                </h:inputText>
              </s:decorate>

              <s:decorate id="firstNameDecorate" template="edit.xhtml">
                <ui:define name="label">First Name:</ui:define>
                <h:inputText id="firstName" value="#{user.firstName}" required="true">
                  <a:support event="onblur" reRender="firstNameDecorate" />
                </h:inputText>
              </s:decorate>

              <s:decorate id="lastNameDecorate" template="edit.xhtml">
                <ui:define name="label">Last Name:</ui:define>
                <h:inputText id="lastName" value="#{user.lastName}" required="true">
                  <a:support event="onblur" reRender="lastNameDecorate" />
                </h:inputText>
              </s:decorate>

              <s:decorate id="passwordDecorate" template="edit.xhtml">
                <ui:define name="label">Password:</ui:define>
                <h:inputSecret id="password" value="#{user.password}" required="true"/>
              </s:decorate>

              <s:decorate id="verifyPasswordDecorate" template="edit.xhtml">
                <ui:define name="label">Verify Password:</ui:define>
                <h:inputSecret id="password" value="#{register.verifyPassword}" required="true"/>
              </s:decorate>

              <div class="buttonBox">
                <h:commandButton id="register" value="Register" action="#{register.register}"/>
                &#160;
                <s:button id="cancel" value="Cancel" view="/home.xhtml"/>
              </div>
            </fieldset>
          </h:form> 
        </div>
      </div>
    </div>
    <div id="footer">Created by Chris Maki for the Utah Java User Group, July 17, 2008</div>
  </div>
</body> 
</html>
